﻿@using Bids.Core.Common.Pager;
@model PagedList<Bids.Core.DomainObjects.User>

@{
    ViewBag.Title = "Index";
    Layout = "~/Areas/Admin/Views/Shared/_LayoutAdmin.cshtml";
}

@section head{
    <script>
    
        jQuery(document).ready(function ($) {
        if("@Request["Search_Field"]"!=""){$("#Search_Field").attr("value", "@Request["Search_Field"]");}            
        if("@Request["Search_Compare"]"!=""){$("#Search_Compare").attr("value", "@Request["Search_Compare"]");}            
        if("@Request["Search_Key"]"!=""){$("#Search_Key").attr("value", "@Request["Search_Key"]");}            
        if("@Request["listRows"]"!="")
        {
            $("#listRows").attr("value", "@Request["listRows"]");
        }
        else
        {
            $("#listRows").attr("value", "10");
        }
         })
    
    </script>
}

 <div class="mytopdiv">
        <div class="mytopduvrows">
            <form action="@Url.Action("Index")" method="get" >

            <div class="fLeft">&nbsp;查询条件:
                <select class="small bLeft" id="Search_Field" name="Search_Field">
                <option value="UserName">用户名</option>
                <option value="NickName">昵称</option>
                </select>&nbsp;&nbsp;
                       
                <select class="small bLeft" name="Search_Compare" id="Search_Compare">
                <option value="Like">包含</option>
                </select>&nbsp;&nbsp;
                    
            </div>
            <div class="fLeft">
                <input TYPE="text" title="查询关键字" name="Search_Key" id="Search_Key" class="medium" >
                <input TYPE="text" style=" width: 40px; text-align: center;"  title="每页多少条" name="listRows" id="listRows" class="medium" value="" >
            </div>
            <div class="impBtn hMargin fLeft shadow" ><input type="submit" value="查询" onclick="" class="search imgButton"></div>
            </form>
            <div class="impBtn hMargin fLeft shadow" ><input type="button" id="refresh" name="refresh" value="刷新" onclick="refresh()" class="refresh imgButton"></div>
        </div>

    </div>

   <div class="mytopduvrows">
        <div class="impBtn hMargin fLeft shadow" ><input type="button" id="" name="add" value="新增" onclick="add()" class="add imgButton"></div>
        <div class="impBtn hMargin fLeft shadow" ><input type="button" id="" name="edit" value="编辑" onclick="edit()" class="edit imgButton"></div>
        <div class="impBtn hMargin fLeft shadow" ><input type="button" id="refresh" name="refresh" value="刷新" onclick="refresh()" class="refresh imgButton"></div>
        <div class="hMargin fLeft shadow" style="margin-left:20px;"></div>
        <div class="fLeft">@Html.Raw((string)@TempData["Message"])</div>
        <div style=" clear:both; "></div>
    </div>

    <div class="maindiv">
        
            <table class="mytable" cellspacing="0" cellpadding="3" id="gvList">
                <tr>
                    <th width="50" ><input type="checkbox" id="check_box"  onclick="CheckAll('gvList');" /></th>
                    <th>ID</th>
                    <th>用户名</th>
                    <th>昵称</th>
                    <th>用户类型</th>
                    <th>建立间时</th>
      
                    <th  width="100">状态</th>
                    <th  width="100">操作</th>
                </tr>
                
                @{
                    foreach(var m in Model)
                    {
                        <tr class="row" onmouseover="over(event)" onmouseout="out(event)" onclick="change(event)">
                            <td width="50" align="center"><input type="checkbox" name="key" value="@m.ID" /></td>
                            <td align="center">@m.ID</td>
                            <td align="center">@m.UserName</td>
                            <td align="center">@m.NickName</td>
                            <td align="center">@m.UserType.ToString()
                            </td>
                            <td>@m.CreateTime
                            </td>
                 
                            <td>
                               
                            </td>
                            <td><a href="javascript:edit('@m.ID')">编缉</a>&nbsp;&nbsp;&nbsp;<a href="javascript:del('@m.ID')">删除</a> </td>
                        </tr>
                    }
                    
                    if(Model.Count()==0)
                    {
                        <tr>
                            <td colspan="8" style=" height:40px; " >不存在数据</td>
                        </tr>
                    }
                 }

            </table>

        <div style=" text-align: center; margin-top: 10px; margin-bottom: 10px; ">
            @Html.Pager(Model, new PagerOptions { PageIndexParameterName = "page", CurrentPagerItemWrapperFormatString = "<a class=\"selected\">{0}</a>"})
            </div>
       
    </div>